import React, { Component } from 'react'

export class Child extends Component {
    constructor(props){
        super(props)
        console.log("子constructor");
        console.log(props);
        // this.state={
        //     arr:props.arr
        // }
    }
    componentDidMount(){
        console.log("子componentDidMount");
    }
    //※※※※  
    shouldComponentUpdate(prev){
        // debugger
        return true
    }
    componentDidUpdate(){
        console.log("子componentDidUpdate");
    }
    componentWillUnmount(){
        console.log("子componentWillUnmount");
    }
    render() {
        console.log("子render");
        // let {list} = this.state
        let {arr} = this.props
        return (
            <div>
                Child
                {
                    arr.map(item=>(<div key={item}>{item}</div>))
                }
                <button onClick={this.props.btn}></button>
            </div>
        )
    }
}

export default Child
